package com.dbh.company.buildbook;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Console;
import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.dbh.company.buildbook.bean.ConfigVO;
import com.dbh.company.buildbook.bean.ProjectBlackListReq;

import java.util.List;
import java.util.Map;

/**
 * @author dongbanghui
 * @create 2023/11/20
 */
public class ProjectBlackListFlush {

    public static void main(String[] args) {
        ExcelReader reader = ExcelUtil.getReader("D:\\Administrator\\Downloads\\1101进行物理删除的1561个楼盘列表.xlsx");
        List<Map<String, Object>> mapList = reader.readAll();
        for (Map<String, Object> map : mapList) {
            Long resblockId = Convert.toLong(map.get("楼盘ID"));
            String name = Convert.toStr(map.get("楼盘名称"));
            ProjectBlackListReq projectBlackListReq = new ProjectBlackListReq(resblockId, name);
            add(projectBlackListReq);
        }
    }

    public static void add(ProjectBlackListReq req) {
        String url = "http://backend-mr.ke.com/v1//projects/blacklist/add";
        String body = HttpRequest.post(url)
                .header("Cookie", "crosSdkDT2019DeviceId=-uudqok-p0z6tw-u5tozzmsej9s39l-t6zeqcw9i; ketest-env=production; _ga=GA1.2.2121015128.1686129466; wx_device_id=bUTx-Zs85VX-EJ38i6V8ZKBFvZtdlNd_7n7X1cq3OrE=; ke_uuid=f975736ecd03071f59f4d5c22f49dd01; _ga_F0DQ6TTSVW=GS1.2.1700654483.55.1.1700654678.60.0.0; ketest-session=1ir1uu9gy876j22jwuif6tqrbekipwko; ketest-user=eyJsb2dpbl91c2VyIjogIjEwMDAwMDAwMjkxMzg0OTgiLCAiYWNjb3VudCI6ICJkb25nYmFuZ2h1aTAwMSIsICJhY2NvdW50U3lzdGVtSWQiOiAiZW1wbG95ZWUiLCAiYXZhdGFyIjogIm51bGwiLCAiYmlydGhkYXkiOiAibnVsbCIsICJidXNpbmVzc1Rva2VuIjogIjIuMDExMWE5YmViMjg0Mzg1YTlmMDAwMWNiNTQy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hEqcL+lJqR+cIKTyZnfP5McD4oeA9hAiDfgNxkywxKwSIMYmkoSzJ3vORKJU=; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22ce301845-8fe2-4a00-96fb-8f5ac09fbf35%22%2C%22first_id%22%3A%2218976818cbd94a-066522c3f35ba78-7e565470-2073600-18976818cbe2427%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%2C%22%24latest_referrer_host%22%3A%22%22%7D%2C%22%24device_id%22%3A%2218976818cbd94a-066522c3f35ba78-7e565470-2073600-18976818cbe2427%22%7D; casgwusercred=JeB0aqScXfnBqHHKMTc-uGpJVi6ZZ1nUVn2pHmKBo7rUpT7l-rLFQd-XEzym67bxy0pXYvm_d2kFU4CB9RsMixEcuh-Bv_UCs6V3Dg66bSAmoB72xINFRI0EGG9fV_5b2jEKsioSqEj0zF0Ls5oULgOShyQ5GTbQ5mtn4_B5lr8; crosgwusercred=P9_5unP3MN3GId8ENxx3RY9uU-nj4kU9Fn2168bOqP8sxHwPpu4GZfyNevKWphxJzNo6kxYSeMDaKexMlP0sCQ96f65106cdd3c1c3e15c82bd3fad0732; _account_=dongbanghui001; _userFullEmail_=dongbanghui001%40ke.com; pilot_ke_token=2.0111a9beb284385a9f0001cb54414f0cee7b9cd43e; ztt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhX2NsaWVudCIsImV4cCI6MTcwMTIyNzAzNywianRpIjoiZng2Uk1TaFNxekVobFh2YVRJc29Fdz09IiwiaWF0IjoxNzAxMTQwNjM3LCJpc3MiOiI1MmVlYmY3ZDk3NzA0MTdmOGRlMjUwMmUxNzc2YmQ0MyIsInIiOiJ7XCJpXCI6XCIxMC40LjYwLjI4XCIsXCJ1XCI6XCJcIixcInNcIjpcIlwiLFwiYVwiOjMsXCJlXCI6MTcwMTIyNzAzNyxcImxcIjowLFwiZFwiOjAsXCJlaVwiOlwiXCIsXCJpaVwiOlwiMTAuNC42MC4yOFwifSJ9.WXPdZrnz04TC_qK0Y7sJq4gNxABu7k7C6Fvl5OMW_Mc; lianjia_uuid=2706bcb6-4ad2-49d9-9412-f1cdf3b01326; lianjia_ssid=7d6a30a3-3c83-4f02-9b5c-eb9a2cf13d85; mr_backend_login_user=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXNzaW9uSWQiOiIyLjAwMTQ1OGU0OGY4MWM5MDBhMjA1ZjE1YTNkYzE3ZmU5MWMifQ.I51989WYXlqpxhWlNqrOrr2GNYEl6L74SAxkCzQczXY; mr_backend_service_uid=1000000029138498")
                .body(JSONUtil.toJsonStr(req))
                .execute()
                .body();
        Console.log(body);
    }
}
